[nanvix] fix(libcxx): add Nanvix platform support (clock + rune table)#36
Merged
Merged
Conversation
Stage-1 build of libc++ failed with two platform-detection errors:
chrono.cpp: error: "Monotonic clock not implemented on this platform"
__locale: error: unknown rune table for this platform -- do you mean
to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
Both are because libc++ does not recognize Nanvix. Add it:
- chrono.cpp: Nanvix provides clock_gettime() and CLOCK_MONOTONIC (declared in
<time.h>, defined in libc.a), so add __nanvix__ to the targets that define
_LIBCPP_HAS_CLOCK_GETTIME (alongside OpenBSD/hurd); steady_clock then uses
clock_gettime(CLOCK_MONOTONIC). The libc's <unistd.h> does not advertise
_POSIX_TIMERS, which is why the generic detection missed it.
- __config + __cxx03/__config: Nanvix has no platform ctype "rune table", so
use libc++'s built-in default table by adding __nanvix__ to the
_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE list (as NuttX/Fuchsia/wasi do). The
locale base API falls through to the BSD POSIX fallbacks, keeping
localization (<locale>, <iostream>, <regex>) enabled.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The #35 merge cleared the wide-character blocker; the libc++ build then failed with two platform-detection errors:
Both are because libc++ doesn't recognize Nanvix as a platform.
Fix (add Nanvix platform support to libc++)
chrono.cpp— Nanvix providesclock_gettime()+CLOCK_MONOTONIC(declared in<time.h>, defined inlibc.a), so add__nanvix__to the targets that define_LIBCPP_HAS_CLOCK_GETTIME(alongside OpenBSD/hurd).steady_clockthen usesclock_gettime(CLOCK_MONOTONIC). (The libc's<unistd.h>doesn't advertise_POSIX_TIMERS, which is why the generic detection missed it — fixing that upstream would also work.)__config+__cxx03/__config— Nanvix has no platform ctype "rune table", so use libc++'s built-in default table by adding__nanvix__to the_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLElist (as NuttX/Fuchsia/wasi do). The locale base API then falls through to the BSD POSIX fallbacks.This keeps localization enabled (
<locale>,<iostream>,<regex>) rather than disabling it — consistent with the fork's existing__nanvix__handling already present in__config.Caveat
Iterative stage-1 bring-up. These clear the two detection errors; subsequent libc++/libc++abi compile or link issues may surface next. Validated on merge (PR CI verifies stage 0 only).